package com.xydtech.web.controller.system;

import com.xydtech.common.core.controller.BaseController;
import com.xydtech.common.core.domain.entity.SysDictData;
import com.xydtech.common.utils.StringUtils;
import com.xydtech.framework.web.service.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * 数据字典汇总信息
 *
 * @author xydtech
 */
@Controller
@RequestMapping("/system/dict/info")
public class SysDictInfoController extends BaseController {

    @Autowired
    private DictService dictService;

    @GetMapping("/getDictDataByDictType")
    @ResponseBody
    public List<SysDictData> getDictDataByDictType(String dictType) {

        List<SysDictData> list = new ArrayList<>();
        if(StringUtils.isBlank(dictType)){
            return list;
        }
        try {
            return dictService.getType(dictType);
        } catch (Exception ex) {
            return list;
        }
    }


}
